<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<script>
		var add = function(num1, num2) {
			// num1 = num1 || 0;
			// num2 = num2 || 0;
			/*if (typeof num1 === "undefined")
				num1 = 0;
			if (typeof num2 === "undefined")
				num2 = 0;*/
			return num1 + num2;
		}

		/*var add = function(num1, num2) {
			console.log(num1, num2);
			return num1 + num2;
		}

		console.log(add(5, 3, 7));*/

		// 实现一系列数字之和的求解
		function add () {
			console.log(arguments)
			/*console.log("参数个数：" + arguments.length)
			console.log("第三个参数：" + arguments[2])*/
			var sum = 0;
			for (var i = 0; i < arguments.length; i++) { // i 表示的是参数的编号 index
				sum += arguments[i];
			}
			return sum;
		}

		// console.log(add(3, 5))
		// console.log(add(2,3,4))
		// console.log(add(2,3,4,5,7))
	</script>

	<script>
		// 返回值
		function test() {
			console.log("abc");
			return "ijk";

			console.log("以后")
		}

		console.log(test());
	</script>
</body>
</html>